-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering of invalid spatial values #540
Conversation
Amogh-Bharadwaj
commented
Oct 19, 2023
- Detects invalid spatial values such as single-point linestrings and open polygons, setting them as null on the pull side for QRep and CDC
@@ -13,6 +14,7 @@ import ( | |||
"github.com/jackc/pgx/v5/pgtype" | |||
"github.com/lib/pq/oid" | |||
log "github.com/sirupsen/logrus" | |||
geom "github.com/twpayne/go-geos" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
could not import github.com/twpayne/go-geos (-: go build github.com/twpayne/go-geos:
@@ -124,6 +124,12 @@ func (g *GenericSQLQueryExecutor) CountRows(schemaName string, tableName string) | |||
return count, err | |||
} | |||
|
|||
func (g *GenericSQLQueryExecutor) CountNonNullRows(schemaName string, tableName string, columnName string) (int64, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
line is 123 characters (lll)
@@ -124,6 +124,12 @@ | |||
return count, err | |||
} | |||
|
|||
func (g *GenericSQLQueryExecutor) CountNonNullRows(schemaName string, tableName string, columnName string) (int64, error) { | |||
var count int64 | |||
err := g.db.QueryRowx("SELECT COUNT(CASE WHEN " + columnName + " IS NOT NULL THEN 1 END) AS non_null_count FROM " + schemaName + "." + tableName).Scan(&count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
line is 162 characters (lll)
case qvalue.QValueKindGeography, qvalue.QValueKindGeometry, qvalue.QValueKindPoint: | ||
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("CAST(%s:\"%s\" AS STRING) AS %s,", | ||
case qvalue.QValueKindGeography: | ||
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
line is 134 characters (lll)
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,", | ||
toVariantColumnName, columnName, targetColumnName)) | ||
case qvalue.QValueKindGeometry: | ||
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOMETRY(CAST(%s:\"%s\" AS STRING),true) AS %s,", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
line is 133 characters (lll)